package com.example.iccil.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.iccil.mapper.UserThirdPartyMapper;
import com.example.iccil.model.entity.UserThirdParty;
import com.example.iccil.model.enums.UserThirdPartyBindStatusEnum;
import com.example.iccil.service.UserThirdPartyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author wujianxin
 * @description 针对表【user_third_party】的数据库操作Service实现
 * @createDate 2025-07-10 11:28:39
 */
@Service
public class UserThirdPartyServiceImpl extends ServiceImpl<UserThirdPartyMapper, UserThirdParty> implements UserThirdPartyService {

    @Resource
    private UserThirdPartyMapper userThirdPartyMapper;

    @Override
    public boolean checkBindStatus(String encryptUUID, String source) {
        UserThirdParty userThirdParty = userThirdPartyMapper.checkBindStatus(encryptUUID, source);
        // 未查询到用户说明没有绑定过，直接返回false
        if (userThirdParty == null) {
            return false;
        }
        Integer bindStatus = userThirdParty.getIsbind();
        if (bindStatus.equals(UserThirdPartyBindStatusEnum.UN_BIND.getStatus()) ||  bindStatus.equals(UserThirdPartyBindStatusEnum.UN_SAVE.getStatus())) {
            return false;
        } else return bindStatus.equals(UserThirdPartyBindStatusEnum.IS_BIND.getStatus());
    }
}




